#include <iostream>
#include <vector>
#include <cstdio> 

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int >  vec;
typedef pair < int , int > pii;

int read() {
  int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
  while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 1e5 + 10;

ll buf[N << 2],n,mxd[N],son[N];
ll *f[N],*g[N],*cur = buf;
vec G[N];
ll ans;

void dfs(int x,int p) {
    mxd[x] = 1; for(auto y : G[x]) if(y ^ p) dfs(y,x),(son[x] = mxd[y] > mxd[son[x]] ? y : son[x]),mxd[x] = max(mxd[x],mxd[y] + 1);
}

void dp(int x,int p) {
    if(son[x]) f[son[x]] = f[x] + 1,g[son[x]] = g[x] - 1,dp(son[x],x);
    ans += g[x][0]; f[x][0] = 1;
    for(auto y : G[x])
	if(y ^ p && y ^ son[x]) {
	    f[y] = cur; cur += mxd[y] << 1; g[y] = cur; cur += mxd[y] << 1;
	    dp(y,x);
	    for(int i = 0;i < mxd[y];i++) {
		if(i) ans += f[x][i - 1] * g[y][i];
		ans += g[x][i + 1] * f[y][i];
	    }
	    for(int i = 0;i < mxd[y];i++) {
		if(i) g[x][i - 1] += g[y][i];
		g[x][i + 1] += f[x][i + 1] * f[y][i];
		f[x][i + 1] += f[y][i];
	    }
	}
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in; for(int i = 1,u,v;i < n;i++) u = in,v = in,G[u].pb(v),G[v].pb(u);
    dfs(1,0); f[1] = cur; cur += mxd[1] << 1; g[1] = cur; cur += mxd[1] << 1;
    dp(1,0); printf("%lld\n",ans); return 0;
} 
